Skip to content

Add MCP Streamable HTTP specification support for the client#321

Draft
atesgoral wants to merge 1 commit intomainfrom
streamable-http-client
Draft

Add MCP Streamable HTTP specification support for the client#321
atesgoral wants to merge 1 commit intomainfrom
streamable-http-client

Conversation

@atesgoral
Copy link
Copy Markdown
Contributor

Summary

Implements the MCP Streamable HTTP specification for the Ruby SDK client. Rebased from #210 (original work by @keisku) onto current main, with merge conflict resolution, bug fixes, and all review feedback addressed.

Original PR: #210 by @keisku — thank you for kicking off this effort!

Already supported (before this PR):

  • POST with JSON body
  • Accept: application/json, text/event-stream header
  • Parse application/json response

This PR adds:

  • Parse text/event-stream (SSE) response via event_stream_parser gem
  • Session management (MCP-Session-Id header)
  • Handle 404 as session expiration
  • Handle 202 Accepted when server delivers response via SSE stream
  • DELETE for session termination
  • Protocol version header (MCP-Protocol-Version)
  • Client conformance test runner (conformance/client.rb)

Changes from #210

  • Rebased onto current main (resolved merge conflicts with faraday_customizer and test changes)
  • Made event_stream_parser an optional dependency (like Faraday), per @koic's feedback — users add it to their Gemfile when needed
  • Addressed all of @koic's review comments (TODO descriptions, consistent header naming, gemspec vs Gemfile dependency placement)
  • Fixed 202 Accepted response handling when server delivers via SSE stream

Commits

  1. Add MCP Streamable HTTP specification support for the client@keisku's original work, squashed and rebased
  2. Handle 202 Accepted response when server delivers via SSE stream — bug fix
  3. Address PR review feedback from Koichi — review feedback
  4. Make event_stream_parser an optional dependency like Faraday — addresses @koic's latest feedback

Test plan

  • ruby -I lib -I test test/mcp/client_test.rb — 40 runs, 125 assertions, 0 failures
  • ruby -I lib -I test test/mcp/client/http_test.rb — 20 runs, 48 assertions, 0 failures
  • Full test suite: 704 runs, 1762 assertions, 0 failures
  • RuboCop clean on changed files

Pending TODOs (out of scope)

🤖 Generated with Claude Code

@atesgoral atesgoral force-pushed the streamable-http-client branch from ee06e38 to 663cf20 Compare April 18, 2026 15:18
@atesgoral atesgoral marked this pull request as draft April 18, 2026 15:28
@atesgoral atesgoral force-pushed the streamable-http-client branch from 663cf20 to a499248 Compare April 18, 2026 15:42
Implements the MCP Streamable HTTP specification for the Ruby SDK
client: SSE response parsing via event_stream_parser, session
management, 202 Accepted handling, DELETE for session termination,
and protocol version header.

Co-Authored-By: Ates Goral <ates@magnetiq.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants